package TankGame1;

import java.util.Vector;

/**
 * 自己坦克
 */
public class MyTank extends TankModel {

    public MyTank(int x, int y, int direction, Vector<EnemyTank> enemyTanks) {
        super(x, y, direction, enemyTanks);
    }

    /**
     * 射击方法
     */
    public void Shooting() {
        int direction = getDirection(); //当前坦克方向
        Shot temp = null;
        switch (direction) {
            case 0:
                temp = new Shot(getX() + 20, getY(), 20, 0);
                break;
            case 1:
                temp = new Shot(getX() + 60, getY() + 20, 20, 1);
                break;
            case 2:
                temp = new Shot(getX() + 20, getY() + 60, 20, 2);
                break;
            case 3:
                temp = new Shot(getX(), getY() + 20, 20, 3);
                break;
        }
        getShots().add(temp);
        Thread thread = new Thread(temp);
        thread.start(); //启动子弹线程
    }

}
